package com.zb.controller;


import com.zb.entity.dto.OrderSysFieldExportDto;
import com.zb.result.Result;
import com.zb.search.SearchDto;
import com.zb.service.ZjAdmOrderSysFieldExportService;
import com.zb.utils.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 后台工单系统字段导出表 前端控制器
 * </p>
 *
 * @author WEN
 * @since 2024-03-03
 */
@Api(tags = "工单系统字段导出类接口")
@RestController
@RequestMapping("/order/field/export")
public class ZjAdmOrderSysFieldExportController {
    @Resource
    private ZjAdmOrderSysFieldExportService admOrderSysFieldExportService;

    @ApiOperation("新增或更改导出字段")
    @PostMapping("/save")
    public Result save(@RequestBody @Valid OrderSysFieldExportDto fieldExport) {
        admOrderSysFieldExportService.save(fieldExport);
        return Result.success(null == fieldExport.getId()? "新增字段成功" : "修改字段成功");
    }

    @ApiOperation("获取字段列表")
    @PostMapping("/getList")
    public Result getList(@RequestBody SearchDto search) {
        return Result.success("获取字段列表成功").data(admOrderSysFieldExportService.getList(search));
    }

    @ApiOperation("根据字段ID获取字段详情")
    @GetMapping("/getDetail/{id}")
    public Result getDetail(@PathVariable @ApiParam(value = "字段ID", required = true) Long id) {
        return Result.success("获取字段详情").data(PageUtil.row(admOrderSysFieldExportService.getDetail(id)));
    }




}
